﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _04.NFactKFact
{
    class nfactkfact
    {
        static void Main(string[] args)
        {
            //n!/k!
            Console.WriteLine("Insert n!n>k>1");
            Console.Write("n= ");
            decimal n = decimal.Parse(Console.ReadLine());
            Console.WriteLine("Insert k");
            Console.Write("k= ");
            decimal k = decimal.Parse(Console.ReadLine());
            decimal nResult = 1, kResult = 1;
            if (n > k && k > 1)
            {
                for (decimal i = 1; i <= n; i++)
                {
                    nResult *= i;
                }
                for (decimal j = 1; j <= k; j++)
                {
                    kResult *= j;
                }
                Console.WriteLine("n! = " + nResult);
                Console.WriteLine("k! = " + kResult);
                Console.WriteLine("n!/k! = " + nResult / kResult);
            }
            else 
            {
                Console.WriteLine("n should be greater than k and k should be greater than 1.Try again later");
            }
        }
    }
}
